package org.linlinjava.litemall.db.service.distribution;

import com.github.pagehelper.PageHelper;
import org.linlinjava.litemall.db.dao.DisMemberInfoMapper;
import org.linlinjava.litemall.db.dao.DisQrCodeMapper;
import org.linlinjava.litemall.db.domain.*;
import org.linlinjava.litemall.db.service.LitemallUserService;
import org.linlinjava.litemall.db.util.DateTools;
import org.linlinjava.litemall.db.vo.TeamVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StringUtils;

import java.util.List;


/**
 * @author sxf
 * @date 2018-07-02
 */
@Service
public class DisQrCodeService {

    @Autowired
    private DisQrCodeMapper codeMapper;


    public void add(DisQrCode info) {
        codeMapper.insertSelective(info);
    }


    public DisQrCode getByUserId(Integer userId) {

        DisQrCodeExample example = new DisQrCodeExample();
        DisQrCodeExample.Criteria criteria = example.createCriteria();

        criteria.andUseridEqualTo(userId);
        List<DisQrCode> list = codeMapper.selectByExample(example);
        if(list.size()>0){
            return list.get(0);
        }
        return null;
    }
}
